#include "../src/CGIAPI.hpp"

int main()
{
    CGIAPI cgi;

    cgi.httpHeader("html");
    cgi.htmlHeadBegin("CGIAPI-Test Website","gb2312");

    
    cgi.addJavaScript(2,"qwq","wsl");
    cgi.addStyle(3,"maxNB","008NB","bcmNB");

    switch (cgi.getSystem())
    {
        case System::iPhone:
            printf("<p>iPhone</p>");
            break;
        case System::Android:
            printf("<p>Android</p>");
            break;
        case System::Windows:
            printf("<p>Windows</p>");
            break;
        case System::Mac:
            printf("<p>Mac OS X</p>");
            break;
        case System::Linux:
            printf("<p>Linux</p>");
            break;
        default:
            printf("<p>Other</p>");
            break;
    }

    printf("<p>User Agent:%s</p><br>",cgi.getAgent().c_str());
    
    map<string,string> m = cgi.getAllParam();
    map<string,string>::iterator it = m.begin();
    while (it != m.end())
    {
        printf("<p>%s:%s</p>",it->first.c_str(),it->second.c_str());
        it++;
    }

    printf("<br><p>operator[]: %s</p>",cgi["test1"].c_str());

    cgi.htmlHeadEnd();

    return 0;
}